
Function.prototype.myBind = function (context) {
    if(typeof this !=='function'){
        throw new TypeError('not function');
    }
    let _this=this;
    console.log(arguments);
    console.log(...arguments);
    let arg=[...arguments].slice(1);
    console.log(arg);
    console.log(...arg);
    return function F() {
        if(this instanceof F){
            return new _this(...arg,...arguments)
        }else{
            return _this.apply(context,arg.concat(arguments))
        }
    }
};
function a(m, n, o) {
    console.log(this.name + ' ' + m + ' ' + n + ' ' + o);
}

var b = {
    name: 'kong'
};

a.myBind(b, 7, 8)(9); // kong 7 8 9
